<template>
  <div class="right_navbox">
    <div class="right_rig">
      <div class="as_wrap">
        <div class="timeout">
          <div class="yidong_c">
            <img src="../assets/img/timeouts.png" alt="">
          </div>
          <div v-if="settings" class="guan_li">
            <p>管理类联考倒计时<strong>{{settings.days.val}}</strong>天</p>
            <p>考试日期：{{settings.examination_time.val}}</p>
          </div>
        </div>
        <div v-if="database" class="free_data">
          <div class="mian_con">
            <p>免费资料</p>
            <nuxt-link to="/databases">MORE</nuxt-link>
          </div>
          <div>
            <div v-for="(itm,index) in database"  class="shi_con">
              <p>{{itm.name}}</p>
              <a target="_blank" :href="itm.link">下载 > </a>
            </div>
            <div class="hjgn">
              <template>
                <el-tabs v-model="activeName" @tab-click="handleClick">
                  <el-tab-pane label="热点资讯" name="first">
                    <p v-for="(ettt,index) in hotnews"  class="nes_ll">
                      <nuxt-link :to="{path:'newsdetail',query:{cate_id:28,id:ettt.id,anchor:'热点资讯',apipath:'articles',detailpath:'articledetail'}}">
                        {{ettt.title}}
                      </nuxt-link>
                    </p>
                  </el-tab-pane>
<!--                  <el-tab-pane label="备考经验" name="second">-->
<!--                    <p class="nes_ll">广东地区管理类联考院校2020考研初试成绩查询方式汇总</p>-->
<!--                    <p class="nes_ll">34所自划线院校2020考研成绩查询方式汇总</p>-->
<!--                    <p class="nes_ll">西藏自治区2020年硕士研究生招生考试初试成绩查询及复查的公告</p>-->
<!--                    <p class="nes_ll">吉林大学关于2020年硕士研究生初试成绩查询的公告</p>-->
<!--                    <p class="nes_ll">吉林大学关于2020年硕士研究生初试成绩查询的公告</p>-->
<!--                    <p class="nes_ll">吉林大学关于2020年硕士研究生初试成绩查询的公告</p>-->
<!--                    <p class="nes_ll">吉林大学关于2020年硕士研究生初试成绩查询的公告</p>-->
<!--                    <p class="nes_ll">MBA提前面试中如何扮演角色？</p>-->
<!--                  </el-tab-pane>-->
                </el-tabs>
              </template>
            </div>
            <div v-if="hotclass" class="bannes_n">
              <div class="block">
                <el-carousel height="150px">
                  <el-carousel-item v-for="(at,index) in hotclass">
                    <img class="img_h" :src="at.image" alt="">
                  </el-carousel-item>
                </el-carousel>
              </div>
            </div>
            <div class="phone">
              <p>申请课程试听</p>
              <div><p><input v-model="sqname" type="text" name="name" id="name2" placeholder="输入您的姓名"></p></div>
              <div><p><input v-model="sqphone" type="text" name="mobile" id="mobile2" placeholder="输入您的手机"></p></div>
              <div><button  @click="freebtn(sqname,sqphone)" style="font-size: 14px;outline: none"  class="apply-submit">申请试听</button></div>
            </div>
            <div class="mri_bottom_question">
              <h4><strong>24小时</strong>报考顾问在线</h4>
              <p>MBA/MPA/MPAcc/MEM</p>
              <div>
                <a href="http://p.qiao.baidu.com/cps/chat?siteId=11408431&userId=24620165" class="mri_qon"><b
                   class="mri_problem">立即提问</b></a>
              </div>
            </div>
            <template v-if="classcourse">
            <div  class="mian_con mian_too">
              <p><img src="../assets/img/date_1ss.png" alt=""> 考研日程</p>
              <nuxt-link :to="{path:'newslist',query:{anchor:'考研日程',apipath:'examschedule',detailpath:'examscheduledetail'}}">更多 ></nuxt-link>
            </div>
            <div v-for="(itemes,index) in classcourse" class="shi_con shi_cmn">
              <p>{{itemes.start_at}}</p>
              <nuxt-link id="a1" :to="{path:'newsdetail',query:{id:itemes.id,anchor:'考研日程',apipath:'examschedule',detailpath:'examscheduledetail'}}">| 查看详情</nuxt-link>
            </div>
            </template>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
    export default {
        name: "right_nav",
        data() {
            return {
                sqname:'',
                sqphone:'',
                settings: '',
                activeName: 'first',
                database: '',
                hotnews: '',
                classcourse:'',
                hotclass:'',
            };
        },
        created() {

            this.$apiconfig().then(res => {
                //console.log(res)
                this.settings = res.setting
            })
            this.$apiGet('data', {type_id: 0, limit: 6}).then(res => {
                this.database = res.data;
            })
            this.$apiGet("articles", {
                cate_id: 28,
                page: 1,
                limit: 7,
                is_index: 1
            }).then(res => {
                this.hotnews = res.data;
            });
            this.$apiGet("examschedule", {
                page: 1, // 分页 ，不传默认1
                limit: 5 // 数量，不传默认10
            }).then(res=>{
                //console.log(res)
                this.classcourse = res.data;
            });
            this.$apiGet("hotcourses", {
                page: 1,
                limit: 3
            }).then(res=>{
                //console.log(res)
                this.hotclass = res.data;
            });
        },
        methods: {
            freebtn(n, p) {
                if (!n) {
                    this.$message.error("请输入姓名");
                    return false;
                }
                if (!/^1[3456789]\d{9}$/.test(p)) {
                    this.$message.error("请输入正确的手机号码");
                    return false;
                }
                //console.log(n, p);
                this.$apiPost("addsignlog", {
                    type_id: 2,
                    name: n,
                    phone: p
                }).then(res => {
                    //console.log(res);
                    if (res.code == 1) {
                        this.$message.success("提交成功");
                    } else {
                        this.$message.error(res.msg);
                    }
                });
            },
            handleClick(tab, event) {
               // console.log(tab, event);
            }
        }
    }
</script>

<style scoped>
  .shi_cmn {
    padding-bottom: 10px;
    border-bottom: 1px solid rgb(229, 229, 229);
    margin: 5px !important;
  }

  .shi_cmn #a1 {
    width: auto!important;
    border-radius: 5px!important;
    border: 0 solid #fff!important;
    padding: 5px!important;
  }

  .mian_too p::after {
    display: none;
  }

  .mian_too {
    margin-top: 33px;
  }

  .mian_too img {
    margin-right: 10px;
  }

  .mian_too p {
    color: #000;
    font-weight: 500;
    display: flex;
    justify-content: center;
    align-items: center;

  }

  .mri_problem {
    background: url(../assets/img/icon_imgs.png) no-repeat;
    background-position: 64px -591px;
    font-size: 15px;
    color: #fff;
    padding-right: 29px;
  }

  .mri_qon :hover {
    transform: translateY(-3px);
  }

  .mri_qon {
    background-color: #e1423f;
    background-image: linear-gradient(120deg, #f65637, #f22121);
    width: 142px;
    height: 37px;
    display: inline-block;
    border-radius: 100px;
    line-height: 37px;
    box-shadow: 0 3px 20px rgba(255, 40, 40, 0.4);
    margin-top: 10px;
    transition: .2s;
  }

  .mri_bottom_question h4 strong {
    color: #ff504e;
  }

  .mri_bottom_question h4 {
    font-size: 20px;
    color: #333;
    font-weight: bold;
    margin-bottom: 3px;
    margin-top: 18px;
  }

  .mri_bottom_question {
    margin-top: 29px;
    background: url(../assets/img/mri_question_bgs.jpg) no-repeat;
    background-position: center bottom;
    width: 280px;
    height: 138px;
    border-top: 1px dotted #e8ebee;
    text-align: center;
    font-size: 15px;
    color: #555;
    position: relative;
    left: -13px;
    bottom: 0;
  }

  .apply-submit {
    text-align: center;
    color: #ffffff !important;
    display: block;
    width: 220px;
    height: 41px;
    background-color: #75ad70;
    border-radius: 6px;
    margin: 0 auto;
    margin-top: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  #name2::-webkit-input-placeholder {
    font-size: 16px;
  }

  #mobile2::-webkit-input-placeholder {
    font-size: 16px;
  }

  #name2, #mobile2 {
    box-sizing: border-box;
    padding-left: 20px;
    outline: none;
    border: none;
    margin-top: 12px;
    width: 220px;
    height: 41px;
    background-color: #efefef;
    border-radius: 6px;
    font-size: 16px;
  }

  .phone p {
    font-size: 16px;
    color: #333;
    text-align: center;
    line-height: 45px;
  }

  .bannes_n {
    margin-top: 10px;
  }

  .img_h {
    width: 100%;
    object-fit: contain;
  }

  .el-carousel__item h3 {
    color: #475669;
    font-size: 14px;
    opacity: 0.75;
    line-height: 150px;
    margin: 0;
  }

  .el-carousel__item:nth-child(2n) {
    background-color: #99a9bf;
  }

  .el-carousel__item:nth-child(2n+1) {
    background-color: #d3dce6;
  }

  .nes_ll {
    color: #404040;
    font-size: 14px;
    line-height: 28px;
    width: 250px;
    height: 28px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-left: 10px;
    background: url(../assets/img/dianss.jpg) no-repeat left center;
  }

  /deep/ .el-tabs__item:hover {
    color: #000;
  }

  /deep/ .el-tabs__active-bar {
    background-color: #c00000;
  }

  /deep/ .el-tabs__item.is-active {
    color: #c00000;
  }

  .shi_con p {
    display: inline-block;
    font-size: 14px;
    color: #555555;
  }

  .shi_con a:hover {
    background: #c00000;
    color: #fff;
  }

  .shi_con a {
    display: inline-block;
    font-size: 14px;
    color: #c00000;
    width: 69px;
    line-height: 24px;
    text-align: center;
    height: 24px;
    border-radius: 30px;
    border: solid 1px #c00000;
    transition: all 300ms ease;
  }

  .shi_con {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
  }

  .triangle_up {
    width: 0px;
    height: 0px;
    border-width: 0 20px 20px;
    border-style: solid;
    border-color: transparent transparent white;
    position: absolute;
    left: -11px;
    bottom: -8px;
  }

  .spanPs {
    background: #f54545;
    position: relative;
    display: inline-block;
    padding: 2px 5px;
    margin-right: -2px;
    padding-bottom: 8px;
    font-size: 14px;
    color: white;
  }

  .mian_con {
    padding-bottom: 10px;
    border-bottom: 1px solid #e8ebee;
  }

  .mian_con a {
    font-size: 14px;
    color: #c00000;
  }

  .mian_con p {
    color: #555555;
    font-size: 16px;
    font-weight: 500;
  }

  .mian_con p::after {
    content: "";
    position: absolute;
    left: 0px;
    bottom: -10px;
    width: 64px;
    height: 3px;
    background: #c00000;
  }

  .mian_con p {
    position: relative;
    font-size: 14px;
  }

  .mian_con {
    display: flex;
    justify-content: space-between;
  }

  .free_data {
    margin-top: 20px;
  }

  .yidong_c {
    margin-top: 23px;
    margin-right: 10px;
  }

  .guan_li p:last-child {
    color: #666;
    font-size: 14px;
  }

  .guan_li p:first-child strong {
    color: #c00000;
    font-size: 30px;
  }

  .guan_li p:first-child {
    color: #000;
    font-size: 14px;
  }

  .timeout {
    display: flex;
    align-items: center;
    border-bottom: 1px dashed #e8ebee;
    padding-bottom: 10px;
  }

  .as_wrap {
    width: 100%;
    box-shadow: 1px 0px 13px #99999938;
    box-sizing: border-box;
    padding: 0 13px;
    padding-top: 19px;
  }

  .right_rig {
    width: 280px;
    height: auto;
    background: #fff;
    padding-bottom: 40px;
  }
   @media (max-width:850px) {
     .right_rig {
       width:100%;
       margin-top:20px;
     }
       .shi_con a {
         display:flex;
         justify-content: center;
         align-items: center;
       }
   }
</style>
